/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package clientservice;

import java.math.BigInteger;


public class RSA {
  

    /**
     * Encrypt message
     * @param publicKey key to encrypt
     * @param modulus module of public key
     * @param message message to encrypt
     * @return byte[] encrypted text
     */
 public byte[] encrypt(byte[] message, String publicKey, String modulus) {
        BigInteger mes = new BigInteger(message);
        BigInteger Key = new BigInteger(publicKey); //public key
        BigInteger mod = new BigInteger(modulus); //modulus
        return mes.modPow(Key, mod).toByteArray();
    }

  
}